package educrypt.gui.components;

import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;

import educrypt.gui.view.CryptanalysisResultView;
import educrypt.i18n.Messages;

class CryptanalysisResultPanel extends EducryptPanel implements
		CryptanalysisResultView {

	private static final long serialVersionUID = -1052494297638147723L;
	private JTextArea txtDecodedText;
	private JTextArea txtKey;

	public CryptanalysisResultPanel() {
		this.setSize(740, 240);
		this.setPreferredSize(this.getSize());
		setLayout(null);

		JLabel lblResult = new JLabel(Messages.getString("guiResult"));
		lblResult.setFont(new Font("Tahoma", Font.BOLD, 15));
		lblResult.setBounds(31, 11, 127, 19);
		add(lblResult);

		JScrollPane scrollPane2 = new JScrollPane();
		scrollPane2.setBounds(381, 72, 328, 146);
		add(scrollPane2);

		txtDecodedText = new JTextArea();
		txtDecodedText.setEditable(false);
		scrollPane2.setViewportView(txtDecodedText);

		JSeparator separator = new JSeparator();
		separator.setBounds(190, 239, 359, 1);
		add(separator);

		JScrollPane scrollPane1 = new JScrollPane();
		scrollPane1.setBounds(31, 72, 328, 146);
		add(scrollPane1);

		txtKey = new JTextArea();
		txtKey.setEditable(false);
		scrollPane1.setViewportView(txtKey);

		JLabel lblKey = new JLabel(Messages.getString("guiKeyword"));
		lblKey.setBounds(31, 41, 328, 20);
		add(lblKey);

		JLabel lblDecodedText = new JLabel(Messages.getString("guiDecodedText")); //$NON-NLS-1$
		lblDecodedText.setBounds(381, 41, 328, 20);
		add(lblDecodedText);

		this.setPanelEnabled(false);

	}

	@Override
	public void showResults(String key, String decodedText) {
		txtKey.setText(key);
		txtDecodedText.setText(decodedText);
	}

	@Override
	public void addListener(ActionListener ctr) {

	}
}
